105 |
105 |
106 for session in json['results']: |
106 for session in json['results']: |
107 self.assertEqual(session['owner'], 'test_user1') |
107 self.assertEqual(session['owner'], 'test_user1') |
108 |
108 |
109 |
109 |
|
110 def test_list_session_filter(self): |
|
111 url = reverse('notes:session-list') |
|
112 self.client.login(username='test_user1', password='top_secret') |
|
113 response = self.client.get(url, {"ext_id__in": ",".join([str(self.session1.ext_id)])}) |
|
114 self.assertEqual(response.status_code, status.HTTP_200_OK) |
|
115 json = response.json() |
|
116 self.assertIn('results', json, "must have results") |
|
117 self.assertIn('count', json, "must have count") |
|
118 self.assertEqual(json['count'], 1, "must have one session") |
|
119 self.assertEqual(len(json['results']), 1, "must have one session") |
|
120 |
|
121 for session in json['results']: |
|
122 self.assertEqual(session['owner'], 'test_user1') |
|
123 |
|
124 |
|
125 def test_list_session_filter_bad(self): |
|
126 url = reverse('notes:session-list') |
|
127 self.client.login(username='test_user1', password='top_secret') |
|
128 response = self.client.get(url, {"ext_id__in": ",".join([str(uuid4())])}) |
|
129 self.assertEqual(response.status_code, status.HTTP_200_OK) |
|
130 json = response.json() |
|
131 self.assertIn('results', json, "must have results") |
|
132 self.assertIn('count', json, "must have count") |
|
133 self.assertEqual(json['count'], 0, "must have no session") |
|
134 self.assertEqual(len(json['results']), 0, "must have no session") |
|
135 |
110 def test_create_session_no_user(self): |
136 def test_create_session_no_user(self): |
111 url = reverse('notes:session-list') |
137 url = reverse('notes:session-list') |
112 response = self.client.post(url, { |
138 response = self.client.post(url, { |
113 'title': "a new session", |
139 'title': "a new session", |
114 'description': "description of the session", |
140 'description': "description of the session", |