def test_create_recorder_status500(self): httpretty.register_uri( httpretty.GET, '%s/admin/add_recorder.cgi' % epiphan_url, status=500) with pytest.raises(requests.HTTPError) as e: response = WebUiChannel.create_recorder(client=self.c) assert '500 Server Error' in e.value.message
def test_create_recorder_status200(self): httpretty.register_uri( httpretty.GET, '%s/admin/add_recorder.cgi' % epiphan_url, status=200, body='{"success":false}') with pytest.raises(IndiscernibleResponseFromWebUiError) as e: response = WebUiChannel.create_recorder(client=self.c) assert 'expect response status 302, but got (200)' in e.value.message
def test_create_recorder_missing_location(self): httpretty.register_uri( httpretty.GET, '%s/admin/add_recorder.cgi' % epiphan_url, status=302) httpretty.register_uri( httpretty.GET, '%s/admin/recorder57/archive' % epiphan_url, status=200) with pytest.raises(IndiscernibleResponseFromWebUiError) as e: response = WebUiChannel.create_recorder(client=self.c) assert 'location header missing' in e.value.message
def test_create_recorder_ok(self): httpretty.register_uri( httpretty.GET, '%s/admin/add_recorder.cgi' % epiphan_url, status=302, location='/admin/recorder57/archive') httpretty.register_uri( httpretty.GET, '%s/admin/recorder57/archive' % epiphan_url, status=200) response = WebUiChannel.create_recorder(client=self.c) assert int(response) == 57
def test_create_recorder_location_missing_id(self): httpretty.register_uri( httpretty.GET, '%s/admin/add_recorder.cgi' % epiphan_url, status=302, location='/admin/recorderXX/archive') httpretty.register_uri( httpretty.GET, '%s/admin/recorderXX/archive' % epiphan_url, status=200) with pytest.raises(IndiscernibleResponseFromWebUiError) as e: response = WebUiChannel.create_recorder(client=self.c) assert 'cannot parse channel created from location' in e.value.message
def test_create_recorder_status301(self): httpretty.register_uri( httpretty.GET, '%s/admin/add_recorder.cgi' % epiphan_url, status=301, location='/admin/recorder57/archive') httpretty.register_uri( httpretty.GET, '%s/admin/recorder57/archive' % epiphan_url, status=200) with pytest.raises(IndiscernibleResponseFromWebUiError) as e: response = WebUiChannel.create_recorder(client=self.c) assert 'expect response STATUS 302, but got (301)' in e.value.message