{"id":16629035,"url":"https://github.com/reisraff/mockings","last_synced_at":"2025-07-23T21:32:23.496Z","repository":{"id":150583508,"uuid":"183491056","full_name":"reisraff/mockings","owner":"reisraff","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-27T19:09:23.000Z","size":17,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T16:46:22.546Z","etag":null,"topics":["assert","assertion","assertions","go","golang","library","mock","mocker","mocking","unit-test","unit-testing"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reisraff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-25T18:43:00.000Z","updated_at":"2022-04-20T18:24:02.000Z","dependencies_parsed_at":"2023-06-11T07:45:08.420Z","dependency_job_id":null,"html_url":"https://github.com/reisraff/mockings","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/reisraff/mockings","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reisraff%2Fmockings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reisraff%2Fmockings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reisraff%2Fmockings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reisraff%2Fmockings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reisraff","download_url":"https://codeload.github.com/reisraff/mockings/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reisraff%2Fmockings/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266753672,"owners_count":23979139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assert","assertion","assertions","go","golang","library","mock","mocker","mocking","unit-test","unit-testing"],"created_at":"2024-10-12T04:39:08.958Z","updated_at":"2025-07-23T21:32:23.425Z","avatar_url":"https://github.com/reisraff.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mockings\n\n```go\npackage service\n\nimport \"testing\"\nimport \"errors\"\nimport \"app/app/entity\"\nimport \"app/app/service\"\nimport mockings \"github.com/reisraff/mockings/mockings\"\nimport assert \"github.com/stretchr/testify/assert\"\n\ntype DatabaseWriterMock struct {\n}\n\nfunc (self DatabaseWriterMock) Insert(entity interface{}) {\n    mockings.AddCall(\u0026self, \"Insert\", []interface{}{entity})\n}\n\nfunc (self DatabaseWriterMock) Save(entity interface{}) {\n    mockings.AddCall(\u0026self, \"Save\", []interface{}{entity})\n}\n\nfunc (self DatabaseWriterMock) Remove(entity interface{}) {\n    mockings.AddCall(\u0026self, \"Remove\", []interface{}{entity})\n\n}\ntype UploadProviderMock struct {\n    upload.UploadProvider\n}\n\nfunc (self UploadProviderMock) Validate(v *multipart.FileHeader) error {\n    result := mockings.AddCall(\u0026self, \"Validate\", []interface{}{v})\n    return mockings.ErrorOrNil(result[0])\n}\n\nfunc (self UploadProviderMock) GetExtension(v *multipart.FileHeader) string {\n    result := mockings.AddCall(\u0026self, \"GetExtension\", []interface{}{v})\n    return result[0].(string)\n}\n\nfunc (self UploadProviderMock) Move(v *multipart.FileHeader, v2 string) error {\n    result := mockings.AddCall(\u0026self, \"Move\", []interface{}{v, v2})\n    return mockings.ErrorOrNil(result[0])\n}\n\nfunc (self UploadProviderMock) Remove(v string) {\n    mockings.AddCall(\u0026self, \"Remove\", []interface{}{v})\n}\n\nfunc (self UploadProviderMock) GetUploadDir() string {\n    result := mockings.AddCall(\u0026self, \"GetUploadDir\", []interface{}{})\n    return result[0].(string)\n}\n\nfunc GetNotificationService() service.NotificationService {\n    notificationService := service.NotificationService{}\n\n    return notificationService\n}\n\nfunc TestCreate(t *testing.T) {\n\n    mockings.Reset()\n\n    notification := entity.Notification{}\n\n    notificationService := GetNotificationService()\n\n    databaseWriterMock := DatabaseWriterMock{}\n    notificationService.SetDatabaseWriter(\u0026databaseWriterMock)\n\n    notificationService.Create(\u0026notification)\n\n    assert.NotEmpty(t, notification.GetGuid())\n\n    mockings.AssertCalledWith(t, \u0026databaseWriterMock, \"Insert\", []interface{}{\u0026notification})\n}\n\nfunc TestUpdateErrorMovingImage(t *testing.T) {\n    mockings.Reset()\n\n    mime := make(map[string][]string, 0)\n\n    fileheader := multipart.FileHeader{}\n    fileheader.Filename = \"bla\"\n    fileheader.Header = mime\n    fileheader.Size = 1\n\n    notification := entity.Notification{}\n    notification.SetId(1)\n    notification.SetUploadedImage(\u0026fileheader)\n\n    notificationService := GetNotificationService()\n\n    databaseWriterMock := DatabaseWriterMock{}\n    notificationService.SetDatabaseWriter(\u0026databaseWriterMock)\n\n    uploadProviderMock := UploadProviderMock{}\n    mockings.Mock(\u0026uploadProviderMock, \"Validate\", []interface{}{\u0026fileheader}, []interface{}{nil})\n    mockings.Mock(\u0026uploadProviderMock, \"GetExtension\", []interface{}{\u0026fileheader}, []interface{}{\"jpg\"})\n    mockings.Mock(\u0026uploadProviderMock, \"Move\", mockings.ANY, []interface{}{errors.New(\"Bla\")})\n    notificationService.SetUploadProvider(\u0026uploadProviderMock)\n\n    assert.Error(t, notificationService.Update(\u0026notification))\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freisraff%2Fmockings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freisraff%2Fmockings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freisraff%2Fmockings/lists"}