def test_projects(self): """projects page html""" requests = zip(self.methods, [200, 405, 405, 405, 405, 405, 405]) for method, status in requests: code, reason, headers, body = tests.makeRequest( method=method, url='/projects', headers={'content-length': 0}) self.assertEqual(code, status, 'got: %s, wanted: %s, for: %s' % (code, status, method)) for method, status in requests: code, reason, headers, body = tests.makeRequest( method=method, url='/projects/', headers={'content-length': 0}) self.assertEqual(code, status, 'got: %s, wanted: %s, for: %s' % (code, status, method))
def test_testcontent(self): """testcontent page html""" expected_code = None if tests.HOST != tests.LOCALHOST: expected_code = 403 body = 'helloWorld' code, reason, headers, body = tests.makeRequest( method='POST', url='/testcontent/', body=body, headers={'content-length': len(body)}) self.assertEqual(code, expected_code or 409) if tests.HOST is tests.LOCALHOST: self.assertEqual(body, 'invalid post data "helloWorld="') body = 'name=automatedtest&content=thisIsFoo' code, reason, headers, body = tests.makeRequest( method='POST', url='/testcontent/', body=body, headers={'content-length': len(body)}) self.assertEqual(code, expected_code or 204)
def test_join(self): """join page html""" requests = zip(self.methods, [200, 200, 405, 405, 405, 405, 405]) for method, status in requests: if method == 'POST': body = 'name=automatedtest' else: body = '' code, reason, headers, body = tests.makeRequest( method=method, url='/join', body=body, headers={'content-length': len(body)}) self.assertEqual(code, status, 'got: %s, wanted: %s, for: %s' % (code, status, method))