Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Swiss Unity League Website
Manage
Activity
Members
Labels
Plan
Issues
9
Issue boards
Milestones
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Antoine Albertelli
Swiss Unity League Website
Merge requests
!189
An error occurred while fetching reviewers.
Search functionality
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Search functionality
player-search
into
master
Overview
0
Commits
1
Pipelines
1
Changes
2
Merged
Jari Rentsch
requested to merge
player-search
into
master
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
2
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
d4818f4f
1 commit,
1 year ago
2 files
+
55
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
championship/tests/test_admin_player_search.py
0 → 100644
+
41
−
0
Options
# Copyright 2024 Leonin League
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
django.contrib.admin.sites
import
AdminSite
from
django.contrib.auth.models
import
User
from
django.test
import
TestCase
from
django.urls
import
reverse
from
championship.factories
import
PlayerFactory
class
PlayerAdminTest
(
TestCase
):
def
setUp
(
self
):
self
.
user
=
User
.
objects
.
create_superuser
(
"
admin
"
,
"
admin@test.com
"
,
"
password
"
)
self
.
client
.
force_login
(
self
.
user
)
self
.
url
=
reverse
(
"
admin:championship_player_changelist
"
)
PlayerFactory
(
name
=
"
Username
"
)
PlayerFactory
(
name
=
"
Bob Smith
"
)
def
test_search_both_players
(
self
):
response
=
self
.
client
.
get
(
self
.
url
,
data
=
{
"
q
"
:
"
Username Bob
"
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"
Username
"
)
self
.
assertContains
(
response
,
"
Bob Smith
"
)
def
test_search_one_name
(
self
):
response
=
self
.
client
.
get
(
self
.
url
,
data
=
{
"
q
"
:
"
bob
"
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertNotContains
(
response
,
"
Username
"
)
self
.
assertContains
(
response
,
"
Bob Smith
"
)
Loading