File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ import pytest
3
+ from django .core .urlresolvers import reverse
4
+ from members .models import Member
5
+ from members .tests .fixtures .memberlikes import MemberFactory , MembershipApplicationFactory
6
+ from members .tests .fixtures .types import MemberTypeFactory
7
+
8
+
9
+ @pytest .mark .django_db
10
+ def test_application_approve ():
11
+ mtypes = [MemberTypeFactory (label = 'Normal member' )]
12
+ application = MembershipApplicationFactory ()
13
+ email = application .email
14
+ application .approve (set_mtypes = mtypes )
15
+ Member .objects .get (email = email )
16
+
17
+
18
+ @pytest .mark .django_db
19
+ def test_get_application_form (client ):
20
+ response = client .get (reverse ('members-apply' ))
21
+ assert b'Apply for membership' in response .content
22
+
23
+ # TODO: Figure out a good way to submitting the form
24
+
25
+
26
+ @pytest .mark .django_db
27
+ def test_get_admin_members_list (admin_client ):
28
+ # Create a test member
29
+ member = MemberFactory ()
30
+ response = admin_client .get ('/admin/members/member/' )
31
+ assert member .email in response .content .decode ('utf-8' )
32
+
33
+
34
+ @pytest .mark .django_db
35
+ def test_get_admin_applications_list (admin_client ):
36
+ application = MembershipApplicationFactory ()
37
+ response = admin_client .get ('/admin/members/membershipapplication/' )
38
+ assert application .email in response .content .decode ('utf-8' )
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ import json
3
+
4
+ import pytest
5
+ from members .tests .fixtures .memberlikes import MemberFactory
6
+
7
+
8
+ @pytest .mark .django_db
9
+ def test_get_member_list_json (admin_client ):
10
+ # Make sure we have at least one...
11
+ member = MemberFactory ()
12
+ response = admin_client .get (
13
+ '/api/members/' ,
14
+ content_type = 'application/json'
15
+ )
16
+ result = json .loads (response .content .decode ('utf-8' ))
17
+ assert result ['count' ] > 0
18
+
19
+ # TODO: Figure out a good way to test the HTML API browser
You can’t perform that action at this time.
0 commit comments