Esempio n. 1
0
func Test_String(t *testing.T) {
	expectedString := "URI:/test, Method:GET, Contenttype:contentType, Status:418\n"
	m := model.MockConf{URI: "/test", Method: "GET", ContentType: "contentType", StatusCode: 418}
	got := m.String()
	if got != expectedString {
		t.Errorf("Expected: %v but got: %v", expectedString, got)
	}
}
Esempio n. 2
0
func TestGetFileNameWithQueries_ShouldReturnEncodedFilename(t *testing.T) {
	//GET-/example/query?value=abc&value2=cba = RYK2253FOOJI773UXZASWXUM4AA3CTEF
	expectedFilename := "RYK2253FOOJI773UXZASWXUM4AA3CTEF"
	m := model.MockConf{URI: "/example/query?value=abc&value2=cba", Method: "GET", ContentType: "contentType", StatusCode: 418}
	got := m.GetFileName()
	if got != expectedFilename {
		t.Errorf("Expected: %v but got: %v", expectedFilename, got)
	}
}
Esempio n. 3
0
func TestGetFileName_ShouldReturnEncodedFilename(t *testing.T) {
	//Equals to base 32 uri = / method = GET
	expectedFilename := "AZH5Y2SPPMLFNUGNVXRJGON64IUV3FNB"
	m := model.MockConf{URI: "/", Method: "GET", ContentType: "contentType", StatusCode: 418}
	got := m.GetFileName()
	if got != expectedFilename {
		t.Errorf("Expected: %v but got: %v", expectedFilename, got)
	}
}
Esempio n. 4
0
func (DummyFileSystem) WriteMock(c model.MockConf, content []byte, dirpath string) error {
	log.Printf("Writing mock %v to dummy fs.", c.String())
	return nil
}