Skip to content

Commit

Permalink
Merge 8f50d4b into b98c522
Browse files Browse the repository at this point in the history
  • Loading branch information
owenl131 committed Dec 9, 2017
2 parents b98c522 + 8f50d4b commit 36a8f0e
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,49 @@ def test_delete_permalink(self):
response = self.client.delete(url)
response = json.loads(response.content.decode('utf-8'))
self.assertEqual(response["removed"], True)


class CustomRootSettingsControllerClass(TestCase):

def setUp(self):
self.client = Client()
self.root_settings = {
"root_user_github_login_id": 101,
"root_user_github_login_name": "name",
"client_id": "clientID",
"client_secret": "randomstring_sdfdsfdsfdsf",
"is_cloudcv": True,
"allow_new_logins": True,
"app_ip": "0.0.0.0",
"port": "80"
}
RootSettings.objects.create(
root_user_github_login_id=self.root_settings[
"root_user_github_login_id"],
root_user_github_login_name=self.root_settings[
"root_user_github_login_name"],
client_id=self.root_settings["client_id"],
client_secret=self.root_settings["client_secret"],
is_cloudcv=self.root_settings["is_cloudcv"],
allow_new_logins=self.root_settings["allow_new_logins"],
app_ip=self.root_settings["app_ip"],
port=self.root_settings["port"])

def test_get_root_settings(self):
response = self.client.get('/api/rootsettings')
response = json.loads(response.content.decode('utf-8'))
self.assertEqual(response["client_id"],
self.root_settings["client_id"])
self.assertEqual(
response["root_user_github_login_id"],
self.root_settings["root_user_github_login_id"])

def test_create_root_settings(self):
response = self.client.post('/api/rootsettings', self.root_settings)
self.assertContains(response, '', None, 200)

def test_is_cloudcv(self):
response = self.client.get('/api/is_cloudcv/')
response = json.loads(response.content.decode('utf-8'))
self.assertEqual(response["is_cloudcv"],
self.root_settings["is_cloudcv"])

0 comments on commit 36a8f0e

Please sign in to comment.